package stu.wingsmaker.artofsubway.view.activity;

import stu.wingsmaker.artofsubway.R;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.Menu;

public class MainActivity extends SherlockActivity {
//	FragmentManager fragmentManager;
//	FragmentTransaction fragmentTransaction;
//	FragmentTransaction ft;
//	Fragment fragment;
//	ConcertListFragment clf = new ConcertListFragment();
	//CultureListFragment cult = new CultureListFragment();
	private Button concertBtn;
	private Button cultureBtn;
	private Button favoriteBtn;
	private Button settingBtn;
	String title;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
//		getSupportActionBar().setNavigationMode()
		
		setContentView(R.layout.activity_main);
		
		concertBtn = (Button) findViewById(R.id.concertBtn);
		concertBtn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				title = "concert";
				Intent intent = new Intent(getApplicationContext(), InfoActivity.class);
				intent.putExtra("genre", title);
				startActivity(intent);
			}
		});
		cultureBtn = (Button) findViewById(R.id.cultureBtn);
		cultureBtn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(MainActivity.this, InfoActivity.class);
				
				intent.putExtra("genre", "culture");
				startActivity(intent);
			
			}
		});
		favoriteBtn = (Button) findViewById(R.id.favoriteBtn);
		favoriteBtn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(MainActivity.this, InfoActivity.class);

				intent.putExtra("genre", "favorite");
				startActivity(intent);
			}
		});
		settingBtn = (Button) findViewById(R.id.settingBtn);
		settingBtn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(MainActivity.this, InfoActivity.class);
				intent.putExtra("genre", "setting");
				startActivity(intent);
			}
		});
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		
//		SubMenu submenu = menu.addSubMenu(null);
//        submenu.add(getResources().getString(R.string.concert)).setIcon(R.drawable.abs__ic_search);
//        submenu.add(getResources().getString(R.string.culture)).setIcon(R.drawable.abs__ab_stacked_solid_dark_holo);
//        submenu.add(getResources().getString(R.string.favorite)).setIcon(R.drawable.abs__ic_menu_share_holo_dark);
//        submenu.add(getResources().getString(R.string.setting)).setIcon(R.drawable.action_settings);
//        // Share button itself
//        MenuItem ShareButton = submenu.getItem();
//        ShareButton.setIcon(R.drawable.abs__ic_menu_moreoverflow_holo_dark);
//        ShareButton.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
//
//		
//        MenuItem concertItem = submenu.getItem(0);
//        concertItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
//        concertItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
//			
//			@Override
//			public boolean onMenuItemClick(MenuItem item) {
//				// TODO Auto-generated method stub
//				  // 프래그먼트 교체 기능 넣기 
//				ft = fragmentManager.beginTransaction().replace(R.id.frameLayoutFragment, clf);
//				ft.addToBackStack(null);
//				ft.commit();
//				return false;
//			}
//		});
//        MenuItem cultureItem = submenu.getItem(1);
//        cultureItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
//        cultureItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
//			
//			@Override
//			public boolean onMenuItemClick(MenuItem item) {
//				// TODO Auto-generated method stub
//				CultureListFragment cultF = new CultureListFragment();	
//				ft = fragmentManager.beginTransaction().replace(R.id.frameLayoutFragment, cultF);
//				ft.addToBackStack(null);
//				ft.commit();
//				return false;
//			}
//		});
//        
//        
//        MenuItem favoriteItem = submenu.getItem(2);
//        favoriteItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
//        favoriteItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
//			
//			@Override
//			public boolean onMenuItemClick(MenuItem item) {
//				// TODO Auto-generated method stub
//				return false;
//			}
//		});
//        
//        MenuItem settingItem = submenu.getItem(3);
//        settingItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
//        settingItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
//			
//			@Override
//			public boolean onMenuItemClick(MenuItem item) {
//				// TODO Auto-generated method stub
//				Intent i = new Intent(MainActivity.this, SettingsActivity.class);
//				startActivity(i);
//				return false;
//			}
//		});
//        
		
		com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();
	      inflater.inflate(R.menu.activity_main, menu);
		return true;
		
	}
}
